<?php
/**
 * @author jonathan poelen <jonathan.poelen@gmail.com>
 * @version 1.0: jo_link_noir
 * @date 18-10-2009
 */
class SW_Planet_Element extends SW_Element
{
	/** @var array */
	protected $target;

	/** @var string */
	protected $name;

	/** @var int */
	protected $refUser;


	/**
	 * @param int $id
	 * @param int $ref_user
	 * @param array $target
	 * @param string $name
	 */
	public function __construct($id, $ref_user, array $target, $name='')
	{
		$this->name = $name;
		$this->target = $target;
		$this->refUser = (int)$ref_user;
		parent::__construct($id);
	}

	/**
	 * Retourne un tableau des coordonnées d'un planète
	 * @return array : {galaxie, systeme, position}
	 */
	public function getTarget()
	{
		return $this->target;
	}

	/**
	 * @return string
	 */
	public function getName()
	{
		return $this->name;
	}

	/**
	 * @return int
	 */
	public function getRefUser()
	{
		return $this->refUser;
	}

	/**
	 * @param string $glue = ":"
	 * @return string
	 */
	public function targetGlue($glue = ':')
	{
		return implode($glue, $this->target);
	}
}